/*******************************************************************************
* Project: HWLW-300XA
* File name: memoryio.c
* Description: variables definition about memory-map I/O
* Author: Wang Guoliang
* Create Date: 2006.03.07
* Modifier: 
* Last Modification Date: 
* Shenzhen Unite Winners Laser System Co., Ltd. All rights reserved.
*******************************************************************************/


#include "sl_types.h"


// variables about memory-map I/O

// memory map I/O for PIO1
#pragma section SECT_MEMIO_PIO1

BYTE	pio1_dummy0;
BYTE	pio1_port0_in;
BYTE	pio1_dummy1;
BYTE	pio1_port1_in;
BYTE	pio1_dummy2;
BYTE	pio1_port2_in;
BYTE	pio1_dummy3;
BYTE	pio1_cmd_write;


// memory map I/O for D/A
#pragma section SECT_MEMIO_DAC

WORD	dac_digit_out;

// memory map I/O for RTC
#pragma section SECT_MEMIO_RTC

BYTE	rtc_dummy0;
BYTE	rtc_1second;
BYTE	rtc_dummy1;
BYTE	rtc_10second;
BYTE	rtc_dummy2;
BYTE	rtc_1minute;
BYTE	rtc_dummy3;
BYTE	rtc_10minute;
BYTE	rtc_dummy4;
BYTE	rtc_1hour;
BYTE	rtc_dummy5;
BYTE	rtc_10hour;
BYTE	rtc_dummy6;
BYTE	rtc_1day;
BYTE	rtc_dummy7;
BYTE	rtc_10day;
BYTE	rtc_dummy8;
BYTE	rtc_1month;
BYTE	rtc_dummy9;
BYTE	rtc_10month;
BYTE	rtc_dummy10;
BYTE	rtc_1year;
BYTE	rtc_dummy11;
BYTE	rtc_10year;
BYTE	rtc_dummy12;
BYTE	rtc_week;
BYTE	rtc_dummy13;
BYTE	rtc_control_d;
BYTE	rtc_dummy14;
BYTE	rtc_control_e;
BYTE	rtc_dummy15;
BYTE	rtc_control_f;


// memory map I/O for PIO2
#pragma section SECT_MEMIO_PIO2

BYTE	pio2_dummy0;
BYTE	pio2_port0_out;
BYTE	pio2_dummy1;
BYTE	pio2_port1_out;
BYTE	pio2_dummy2;
BYTE	pio2_port2_out;
BYTE	pio2_dummy3;
BYTE	pio2_cmd_write;


// memory map I/O for PIO3
#pragma section SECT_MEMIO_PIO3

BYTE	pio3_dummy0;
BYTE	pio3_port0_in;
BYTE	pio3_dummy1;
BYTE	pio3_port1_in;
BYTE	pio3_dummy2;
BYTE	pio3_port2_in;
BYTE	pio3_dummy3;
BYTE	pio3_cmd_write;

// back to ROM for code
#pragma section

////////////////////////////////////////////////////////////////////////////////
// Memory-map switch signal output for one pin
void MMSwitchSignalOutput(BYTE *pPIO, BYTE pin, BOOL output)
{
	if (output)
		*pPIO = (*pPIO) | (1 << pin);
	else
		*pPIO = (*pPIO) & (~(1 << pin));
}
